#pragma once

#include "..\\headers.default.h"

namespace voc_pascal
{
	class CFileNameList
	{
	public:
		int FileAmount;

		vector<string> rgFN_Main;
		vector<string> rgFN_SrcImage;
		vector<string> rgFN_GtBoxAnnotation;
		map<string,int> MainNameMap;

	public:
		void myInit(
			string strPN_SrcImages, string strFN_Sfx_SrcImages,
			string strPN_GtBoxAnnotations, string strFN_Sfx_GtBoxAnnotations,
			string strFN_ImageList
			)
		{
			string st;

			ifstream inFile(strFN_ImageList.c_str());

			Clear();
			while (inFile>>st)
			{
				rgFN_Main.push_back(st);
				rgFN_SrcImage.push_back(strPN_SrcImages + st + strFN_Sfx_SrcImages);
				rgFN_GtBoxAnnotation.push_back(strPN_GtBoxAnnotations + st + strFN_Sfx_GtBoxAnnotations);
				MainNameMap[st] = FileAmount;
				++FileAmount;
			}

			inFile.clear();
			inFile.close();
		}
		void Clear()
		{
			FileAmount = 0;
			rgFN_Main.clear();
			rgFN_SrcImage.clear();
			rgFN_GtBoxAnnotation.clear();
			MainNameMap.clear();
		}
		int GetFileIndex(string strFN_Main) const
		{
			map<string,int>::const_iterator citr = MainNameMap.find(strFN_Main);
			if (citr==MainNameMap.end())
				return -1;
			else
				return citr->second;
		}
	};
}

